#pragma once

#ifndef FRAME_H
#define FRAME_H

#include "common_include.h"
#include"feature_point.h"

namespace test_visual_odom{

struct LandMark;
struct FeaturePoint;

struct Frame{
    public:
    EIGEN_MAKE_ALIGNED_OPERATOR_NEW;
    typedef shared_ptr<Frame> Ptr;

    unsigned long keyframe_id_ =0;
    unsigned long frame_id_ =0;
    double time_stamp_;
    bool is_keyframe_ = false;
    cv::Mat left_img_,right_img_;

    vector<shared_ptr<FeaturePoint>> feature_points_left_;
    vector<shared_ptr<FeaturePoint>> feature_points_right_;

    SE3 w_left_pose_;

    mutex w_left_pose_mutex_;

    Frame(){}
    Frame(const cv::Mat& left_img, const cv::Mat& right_img)
    : left_img_(left_img), right_img_(right_img) {
        w_left_pose_ = SE3(Eigen::Quaterniond(1,0,0,0),Eigen::Vector3d(0,0,0));
        static long frame_factory_id = 0;
        frame_id_ = frame_factory_id++;
    }

    void setKeyFrame();

    SE3 getPose(){
        unique_lock<mutex> lck(w_left_pose_mutex_);
        return w_left_pose_;
    }

    void setPose(const SE3 &pose) {
        std::unique_lock<std::mutex> lck(w_left_pose_mutex_);
        w_left_pose_ = pose;
    }
};



}
#endif  // MYSLAM_FRAME_H
